﻿using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.SpreadsheetML.Excel.WorksheetElements
{
    [XmlRoot("cols", Namespace = Constants.ExcelMain)]
    public class ColumnInformation : XmlSerializable
    {
        [XmlElement("col", Namespace = Constants.ExcelMain)]
        public XmlList<Column> Informations { get; set; }

        public ColumnInformation()
        {
            Informations = new XmlList<Column>();
        }
    }

    [XmlRoot("col", Namespace = Constants.ExcelMain)]
    public class Column : XmlSerializable
    {
        [XmlAttribute("min", Form = XmlSchemaForm.Qualified)]
        public uint Minimum { get; set; }

        [XmlAttribute("max", Form = XmlSchemaForm.Qualified)]
        public uint Maximum { get; set; }

        [Optional]
        [XmlAttribute("width", Form = XmlSchemaForm.Qualified)]
        public Nullable<double> Width { get; set; }

        [Optional]
        [XmlAttribute("style", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> Height { get; set; }

        [Optional]
        [XmlAttribute("hidden", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> Hidden { get; set; }

        [Optional]
        [XmlAttribute("bestFit", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> BestFit { get; set; }

        [Optional]
        [XmlAttribute("customWidth", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> CustomWidth { get; set; }

        [Optional]
        [XmlAttribute("phonetic", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> Phonetic { get; set; }

        [Optional]
        [XmlAttribute("outlineLevel", Form = XmlSchemaForm.Qualified)]
        public Nullable<byte> OutlineLevel { get; set; }

        [Optional]
        [XmlAttribute("collapsed", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> Collapsed { get; set; }

        public Column() { }
    }
}
